App({
  globalData: {
    systemInfo: null,
    udpManager: null,
    deviceInfo: null,
    wifiConfig: null,
    mqttConfig: null,
    otaConfig: null
  },
  onLaunch() {
    // 获取系统信息
    try {
      // 使用 getSystemInfoSync 获取系统信息
      const systemInfo = wx.getSystemInfoSync();
      
      // 保存系统信息
      this.globalData.systemInfo = {
        // 设备信息
        brand: systemInfo.brand || '',
        model: systemInfo.model || '',
        platform: systemInfo.platform || '',
        system: systemInfo.system || '',
        
        // 窗口信息
        screenWidth: systemInfo.screenWidth || 0,
        screenHeight: systemInfo.screenHeight || 0,
        windowWidth: systemInfo.windowWidth || 0,
        windowHeight: systemInfo.windowHeight || 0,
        statusBarHeight: systemInfo.statusBarHeight || 0,
        safeArea: systemInfo.safeArea || null,
        
        // 基础信息
        language: systemInfo.language || 'zh_CN',
        version: systemInfo.version || '',
        SDKVersion: systemInfo.SDKVersion || ''
      };
      
      console.log('[系统] 获取系统信息成功:', this.globalData.systemInfo);
      
    } catch (err) {
      console.error('[系统] 获取系统信息失败:', err);
      
      // 设置默认值
      this.globalData.systemInfo = {
        brand: '',
        model: '',
        platform: '',
        system: '',
        screenWidth: 375,
        screenHeight: 667,
        windowWidth: 375,
        windowHeight: 667,
        statusBarHeight: 20,
        safeArea: null,
        language: 'zh_CN',
        version: '',
        SDKVersion: ''
      };
    }
  }
}) 